<template tag="以下文档内容为hycli自动生成">
  <div style="height: 100%">
    <div style="margin:0.8rem;"><h5 style="display:inline">设计任务</h5><span style="margin-left: 0.5rem; color:#999"> UI设计任务跟踪</span>
        <ddmenu :menuList="lob_idList" @valueChanged="onlob_idChange" v-model="form_aaaoz.lob_id" menuType="my_business_line" ></ddmenu>
    </div>
    <hr style="margin-top:0;color:#999"/>
<div class="query">
    
    <div class="tabs">
        <el-tabs v-model="form_aaaoz.archive_status"  @tab-change="onQuery">
            <el-tab-pane v-for="item in archive_statusTabList" :name="item.value" :key="item.value" :label="item.name" 
             ></el-tab-pane>
          </el-tabs>
    </div>
    <el-form :model="form_aaaoz" inline >
        <!-- 日期控件个数： 3 -->
        <el-form-item>
            <!--多日期范围控件 -->
            <el-select v-model="form_aaaoz.single_date_range_name" filterable placeholder="日期类型" style="width:120px;" class="prepend">
                <el-option
                v-for="item in multiQueryDateRange"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
        </el-select>
            <el-date-picker :shortcuts="shortcuts" style="width: 200px" v-model="form_aaaoz.single_date_range_value" type="daterange" start-placeholder="开始日期"
                end-placeholder="结束日期" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
        </el-form-item>
        <!--产品需求 下拉控件多选 -->
        <el-form-item>
            <el-select v-model="form_aaaoz.prod_id" filterable clearable multiple collapse-tags  style="width: 140px"
            collapse-tags-tooltip placeholder="产品需求">
                <el-option v-for="item in prod_idList" :key="item.value" :label="item.name" :value="item.value" />
            </el-select>
        </el-form-item>
        <!-- 控件个数：[{"index":103,"raw":"name","name":"name","cname":"Name","type":{"raw":"varchar2(48)","name":"varchar2","len":48,"dlen":0},"defValue":"","allowNull":false,"constraints":["l","le","q","c","u","v","DN","urow(1)","lw(140)","#like","ps(full)"],"desc":{"raw":"名称","name":"名称"}} {"index":108,"raw":"content","name":"content","cname":"Content","type":{"raw":"varchar2(2000)","name":"varchar2","len":2000,"dlen":0},"defValue":"","allowNull":false,"constraints":["le","q","c","u","v","rows(6)","#like"],"desc":{"raw":"内容","name":"内容"}}] -->
         <el-form-item>
            <el-input clearable style="width: 180px" v-model="form_aaaoz.single_text_value" maxlength="32"
                placeholder="关键字" >
                <template #prepend>
                    <el-select v-model="form_aaaoz.single_text_name" placeholder="查询类型" style="width:84px;">
                        <el-option
                        v-for="item in multiQueryText"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                      </el-select>
                  </template>
            </el-input>
        </el-form-item>

        <span class="ddl">
        </span>
        <el-form-item>
            <el-space wrap>
                <el-button type="primary" icon="Search" @click="onQuery(true)">查询</el-button>
            </el-space>
        </el-form-item>
        
        <div class="blist">
            <el-button-group>
                <el-button :type="$js.page.tagColor(0)"
                
                 icon="Plus"  @click="show_cmpnt_aaapd">UI设计</el-button>
                <el-button :type="$js.page.tagColor(1)"
                 :disabled="bcheck.length==0" 
                 icon="right"  @click="show_cmpnt_aaape">待复评</el-button>
                <el-button :type="$js.page.tagColor(2)"
                 :disabled="bcheck.length==0" 
                 icon="right"  @click="show_cmpnt_aaapf">完成</el-button>
            </el-button-group>
        </div>

        <!-- xtabs -->
        

    </el-form>
</div>
<div>
   <aaapd ref="cmpnt_aaapd" @onsaved="onQuery"></aaapd>
   <aaapc ref="cmpnt_aaapc" @onsaved="onQuery"></aaapc>
   <aaape ref="cmpnt_aaape" @onsaved="onQuery"></aaape>
   <aaapf ref="cmpnt_aaapf" @onsaved="onQuery"></aaapf>
   <aaapa ref="cmpnt_aaapa" @onsaved="onQuery"></aaapa>
   <aaapb ref="cmpnt_aaapb" @onsaved="onQuery"></aaapb>
</div>
<div class="list">
    <el-table :data="dataList_aaaoz"
    @selection-change="handleSelectionChange" 
    v-loading="conf.loading" stripe  style="width: 100%;height:calc(100vh - 160px)"
         empty-text="无数据">le
<el-table-column width="24px" type="expand">
    <template #default="view">
        <el-row :gutter="24">
            <el-col :span="5" class="text-right" style="min-height:26px">编号:</el-col>
            <el-col :span="7" v-text="view.row.le_design_id" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">产品需求:</el-col>
            <el-col :span="7" v-text="view.row.prod_id_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">名称:</el-col>
            <el-col :span="7" v-html="view.row.le_name||'-'" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">负责人:</el-col>
            <el-col :span="7" v-text="view.row.master_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">状态:</el-col>
            <el-col :span="7" v-text="view.row.pdstatus_label" style="min-height:26px"
              :class="$js.page.colorful(view.row.pdstatus,'pdstatus')" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">创建人:</el-col>
            <el-col :span="7" v-text="view.row.creator_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">创建时间:</el-col>
            <el-col :span="7" v-text="view.row.le_create_time" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">内容:</el-col>
            <el-col :span="7" v-html="view.row.le_content||'-'" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">业务线:</el-col>
            <el-col :span="7" v-text="view.row.lob_id_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">初评时间:</el-col>
            <el-col :span="7" v-text="view.row.le_first_review_time" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">终评时间:</el-col>
            <el-col :span="7" v-text="view.row.le_final_review_time" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">归档状态:</el-col>
            <el-col :span="7" v-text="view.row.archive_status_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">归档时间:</el-col>
            <el-col :span="7" v-text="view.row.le_archive_time" style="min-height:26px" ></el-col>
        </el-row>
    </template>
</el-table-column>
          <el-table-column type="selection" width="32" /> 
        	<!--design_id text -->
        <el-table-column  show-overflow-tooltip    align="center" label="编号" >
            <template #default="scope">
                  <span>{{ scope.row.design_id||'-' }}</span>
              </template>
        </el-table-column>
        	<!--name text -->
        <el-table-column  show-overflow-tooltip   min-width="140"   align="center" label="名称" >
            <template #default="scope">
                  <span>{{ scope.row.name||'-' }}</span>
              </template>
        </el-table-column>
        	<!--master select -->
        <el-table-column  :filters="masterList" :filter-method="$js.page.columnfilter" column-key="master"    min-width="80"   prop="master" align="center" label="负责人">
            <template #default="scope">
                <span 
                    v-text="scope.row.master_label"></span>
            </template>
        </el-table-column>
        	<!--pdstatus select -->
        <el-table-column     prop="pdstatus" align="center" label="状态">
            <template #default="scope">
                <span :class="$js.page.colorful(scope.row.pdstatus,'pdstatus')" 
                    v-text="scope.row.pdstatus_label"></span>
            </template>
        </el-table-column>
        <el-table-column :width="21*20+20" align="center" label="任务进度">
        <template #header>
            <gantt mode="header" :maxNo="21" @selectChange="ganttChange" :data="dataList_aaaoz"
            :labels="['初评时间','终评时间']"
            :dates="['first_review_time','final_review_time']"></gantt>
        </template>
        <template #default="scope">
            <gantt mode="line" :maxNo="21" :ganttIdx="ganttIdx" :data="dataList_aaaoz" :row="scope.row.__raw"
            :labels="['初评时间','终评时间']"
            :dates="['first_review_time','final_review_time']"></gantt>
        </template>
        </el-table-column>

<el-table-column fixed="right" align="center" label="操作" width="168">
    <template #default="scope">
        <div class="opts">
            <el-button   type="text" @click="show_cmpnt_aaapc(scope.row)" >详情 </el-button>
            <el-button   type="text" @click="show_cmpnt_aaapa(scope.row)" >编辑 </el-button>
            <el-button   type="text" @click="show_cmpnt_aaapb(scope.row)" >删除 </el-button>
        </div>
    </template>
</el-table-column>
    </el-table>
    <el-pagination :currentPage="form_aaaoz.pi" :page-size="form_aaaoz.ps"
        style="position: absolute; right: 30px;bottom:6px;" :page-sizes="[10,15,20,30, 50, 100]" :background="false" small
        layout="total,sizes,prev, pager, next, jumper" :total="total_aaaoz" @size-change="handleSizeChange"
        @current-change="handleCurrentChange" />
</div>
  </div>
</template>
<script>
// UI设计
import aaapd from "@/views/ws/prod/prod_design.add"
// 详情
import aaapc from "@/views/ws/prod/prod_design.view"
// 待复评
import aaape from "@/views/ws/prod/prod_design.cnfrm"
// 完成
import aaapf from "@/views/ws/prod/prod_design.cnfrm"
// 编辑
import aaapa from "@/views/ws/prod/prod_design.edit"
// 删除
import aaapb from "@/views/ws/prod/prod_design.cnfrm"
// UI设计
import gantt from "@/views/cmpnts/gantt.vue"
// 业务线
import ddmenu from "@/views/cmpnts/ddMenu.vue"



export default {
components: {
    aaapd,
    aaapc,
    aaape,
    aaapf,
    aaapa,
    aaapb,
    gantt,
     ddmenu,
},
data() {
  return {
    shortcuts: this.$js.page.latestDays(),
    cmpnt_funcs:{},
    bcheck:[],
    conf: {
      loading: false,
      progressColor: this.$theia.env.conf.progress || []
    },
    ganttIdx: -1,
        form_aaaoz: {
            pi: 1,
            ps: 15,
            disabled:false,
            single_date_range_name:"",
            single_date_range_value:[],
            single_text_name:"",
            single_text_value:"",
            prod_id:[],
            name:"",
            create_time:"",
            content:"",
            lob_id:"",
            first_review_time:"",
            final_review_time:"",
            archive_status:"",
            },
            prod_idExts:[],
            prod_idList:[],
            masterExts:[],
            masterList:[],
            pdstatusList:[],
            creatorList:[],
            lob_idList:[],
            archive_statusList:[],
            archive_statusTabList:[],
            dataList_aaaoz:[],
            multiQueryDateRange:[{label:"创建时间",value:"create_time"},{label:"初评时间",value:"first_review_time"},{label:"终评时间",value:"final_review_time"},],
            multiQueryText:[{label:"名称",value:"name"},{label:"内容",value:"content"},],
            total_aaaoz:0,
            note_dataList:[],
};
  },
mounted() {
  this.loadEnums_aaaoz()
  this.form_aaaoz.lob_id = this.$theia.user.get("lob_id")
  this.form_aaaoz.single_date_range_name = (this.multiQueryDateRange[0]||{}).value
  this.form_aaaoz.single_text_name = (this.multiQueryText[0]||{}).value
  this.cmpnt_funcs["aaapd"] = this.show_cmpnt_aaapd
  this.cmpnt_funcs["aaapc"] = this.show_cmpnt_aaapc
  this.cmpnt_funcs["aaape"] = this.show_cmpnt_aaape
  this.cmpnt_funcs["aaapf"] = this.show_cmpnt_aaapf
  this.cmpnt_funcs["aaapa"] = this.show_cmpnt_aaapa
  this.cmpnt_funcs["aaapb"] = this.show_cmpnt_aaapb

  this.form_aaaoz = Object.assign(this.form_aaaoz,this.$route.params)
    },
 watch: {
    '$route' () {
      this.form_aaaoz = Object.assign(this.form_aaaoz,this.$route.params)
      this.onQuery();//我的初始化方法
    }
  },
methods: {
  ganttChange(id) {
      this.ganttIdx = id
    },

queryData_aaaoz(mform = {},nform={}){
    //构建查询参数
    let queryForm = Object.assign({},this.form_aaaoz)
    queryForm = Object.assign(queryForm,nform||{})
    
    //处理多个日期选择
    queryForm[this.form_aaaoz.single_date_range_name] = this.form_aaaoz.single_date_range_value
    queryForm[this.form_aaaoz.single_text_name] = this.form_aaaoz.single_text_value
   
    //处理日期范围选择
      queryForm.prod_id = (queryForm.prod_id||[]).join(",")
      queryForm.start_create_time = null
      queryForm.end_create_time = null
    if(queryForm.create_time && queryForm.create_time.length > 1){
      queryForm.start_create_time = queryForm.create_time[0]
      queryForm.end_create_time = queryForm.create_time[1]
    }
      queryForm.start_first_review_time = null
      queryForm.end_first_review_time = null
    if(queryForm.first_review_time && queryForm.first_review_time.length > 1){
      queryForm.start_first_review_time = queryForm.first_review_time[0]
      queryForm.end_first_review_time = queryForm.first_review_time[1]
    }
      queryForm.start_final_review_time = null
      queryForm.end_final_review_time = null
    if(queryForm.final_review_time && queryForm.final_review_time.length > 1){
      queryForm.start_final_review_time = queryForm.final_review_time[0]
      queryForm.end_final_review_time = queryForm.final_review_time[1]
    }

    queryForm[this.form_aaaoz.single_date_range_name] = null
    queryForm.single_date_range_value = null
    queryForm.single_date_range_name = null

    queryForm.single_text_value = null
    queryForm.single_text_name = null
 
    //处理关联表prod_design prod_design 
   
    //发送查询请求
    let that = this
    that.conf.loading = true
    //构建统计查询
  //数据查询
  this.$theia.http.get("/ws/prod/design/query",queryForm).then(res=>{
      if((res.items||[]).length < (queryForm.ps||10)){
        that.form_aaaoz.disabled = true
      }
      that.conf.loading = false
      that.dataList_aaaoz = res.items||[]
      that.total_aaaoz = res.count
      that.resetItemData_aaaoz(that,that.dataList_aaaoz)
    });
  },

  resetItemData_aaaoz(that,lst){
    lst.forEach(item => {
      item.__raw = Object.assign({}, item)
    item.prod_id_label = that.$theia.enum.getName("feedback_prod_req",item.prod_id)
    item.master_label = that.$theia.enum.getName("uimaster",item.master)
    item.pdstatus_label = that.$theia.enum.getName("pdstatus",item.pdstatus)
    item.creator_label = that.$theia.enum.getName("user_account",item.creator)
    item.lob_id_label = that.$theia.enum.getName("my_business_line",item.lob_id)
    item.archive_status_label = that.$theia.enum.getName("archive_status",item.archive_status)
    item.design_id_progress = item.design_id
    item.prod_id_progress = item.prod_id
    item.name_progress = item.name
    item.master_progress = item.master
    item.pdstatus_progress = item.pdstatus
    item.creator_progress = item.creator
    item.create_time_progress = item.create_time
    item.content_progress = item.content
    item.lob_id_progress = item.lob_id
    item.first_review_time_progress = item.first_review_time
    item.final_review_time_progress = item.final_review_time
    item.archive_status_progress = item.archive_status
    item.archive_time_progress = item.archive_time
    item.le_design_id = item.design_id
    item.le_prod_id = item.prod_id
    item.le_name = item.name
    item.le_master = item.master
    item.le_pdstatus = item.pdstatus
    item.le_creator = item.creator
    item.le_create_time = that.$theia.str.dateFormat(item.create_time,'MM/dd')
    item.le_content = item.content
    item.le_lob_id = item.lob_id
    item.le_first_review_time = that.$theia.str.dateFormat(item.first_review_time,'MM/dd HH时')
    item.le_final_review_time = that.$theia.str.dateFormat(item.final_review_time,'MM/dd HH时')
    item.le_archive_status = item.archive_status
    item.le_archive_time = item.archive_time
    if(item.children){
      that.resetItemData_aaaoz(that,item.children)
    }
  });
  }, 
    onChange_prod_id(val){
      this.prod_idList = this.$theia.enum.get("feedback_prod_req",val)
      this.form_aaaoz.prod_id = null
    },
    handleSelectionChange(lst=[]){
      this.bcheck = []
      lst.forEach(f=>{
        this.bcheck.push(f.design_id)
      })
    },
    loadEnums_aaaoz(){
        //产品需求
        this.prod_idList = this.$theia.enum.get("feedback_prod_req","",this.$theia.user.get("lob_id"),false,"/ws/prod/requirement/feedback")
        //业务线
        this.lob_idList = this.$theia.enum.getTree("my_business_line","","" ,99)
        //归档状态
        this.archive_statusTabList = this.$theia.enum.get("archive_status","","",false,"")
        //负责人
        this.masterList = this.$theia.enum.get("uimaster","",this.$theia.user.get("lob_id"),false,"")
        //状态
        this.pdstatusList = this.$theia.enum.get("pdstatus","","" ,false,"")
    },

  handleSizeChange(ps){
    this.form_aaaoz.ps = ps
    this.onQuery(true)
  },
  onlob_idChange(v){
    this.$theia.user.set("lob_id",v)
    this.loadEnums_aaaoz()
    this.onQuery(true)
  },
  handleCurrentChange(pi){
    this.form_aaaoz.pi = pi
    this.onQuery()
  },
  onQuery(refresh){
    if(refresh){
      this.form_aaaoz.pi = 1
    }
    this.queryData_aaaoz ()
  },
show_cmpnt(cmd,row){
  if(this.cmpnt_funcs[cmd]){
    this.cmpnt_funcs[cmd](row)
  }
},
  //详情
  show_cmpnt_aaapc(fm = {}){
    let query = {} 
    query.design_id = fm.design_id|| fm.le_design_id 
    query.prod_id = fm.prod_id|| fm.le_prod_id 
    query.name = fm.name|| fm.le_name 
    query.master = fm.master|| fm.le_master 
    query.pdstatus = fm.pdstatus|| fm.le_pdstatus 
    query.creator = fm.creator|| fm.le_creator 
    query.create_time = fm.create_time|| fm.le_create_time 
    query.content = fm.content|| fm.le_content 
    query.lob_id = fm.lob_id|| fm.le_lob_id 
    query.first_review_time = fm.first_review_time|| fm.le_first_review_time 
    query.final_review_time = fm.final_review_time|| fm.le_final_review_time 
    query.archive_time = fm.archive_time|| fm.le_archive_time 
    query.design_id = fm.design_id

      //2023.4.18添加---

    query.$title="详情"
    this.$refs.cmpnt_aaapc.show(query)
  },
  //UI设计
  show_cmpnt_aaapd(fm = {}){
    let query = {} 
    query.prod_id = fm.prod_id|| fm.le_prod_id 
    query.name = fm.name|| fm.le_name 
    query.master = fm.master|| fm.le_master 
    query.pdstatus = fm.pdstatus|| fm.le_pdstatus 
    query.content = fm.content|| fm.le_content 
    query.first_review_time = fm.first_review_time|| fm.le_first_review_time 
    query.final_review_time = fm.final_review_time|| fm.le_final_review_time 
    query.design_id = fm.design_id

      //2023.4.18添加---

    query.$title="UI设计"
    this.$refs.cmpnt_aaapd.show(query)
  },
  //编辑
  show_cmpnt_aaapa(fm = {}){
    let query = {} 
    query.name = fm.name|| fm.le_name 
    query.master = fm.master|| fm.le_master 
    query.pdstatus = fm.pdstatus|| fm.le_pdstatus 
    query.content = fm.content|| fm.le_content 
    query.first_review_time = fm.first_review_time|| fm.le_first_review_time 
    query.final_review_time = fm.final_review_time|| fm.le_final_review_time 
    query.design_id = fm.design_id

      //2023.4.18添加---

    query.$title="编辑"
    this.$refs.cmpnt_aaapa.show(query)
  },
  //待复评
  show_cmpnt_aaape(fm = {}){
    let query = {}
    query.tm = fm.pt|| fm.le_pt 
    query.design_id = fm.design_id

      //2023.4.18添加---
    query.pd_id = (this.bcheck||[]).join(",")
    query.pdstatus = "30"

    query.$title="待复评"
    this.$refs.cmpnt_aaape.show_aaape(query)
  },
  //完成
  show_cmpnt_aaapf(fm = {}){
    let query = {}
    query.tm = fm.pt|| fm.le_pt 
    query.design_id = fm.design_id

      //2023.4.18添加---
    query.pd_id = (this.bcheck||[]).join(",")
    query.pdstatus = "0"

    query.$title="完成"
    this.$refs.cmpnt_aaapf.show_aaapf(query)
  },
  //删除
  show_cmpnt_aaapb(fm = {}){
    let query = {} 
    query.design_id = fm.design_id|| fm.le_design_id 
    query.design_id = fm.design_id

      //2023.4.18添加---

    query.$title="删除"
    this.$refs.cmpnt_aaapb.show_aaapb(query)
  },
},
};
</script>
<style>
.el-dialog{
  border-radius:5px !important
}
</style>
<style scoped>
.el-form-item {
  margin-right: 10px !important;
}

.opts .el-button--small {
  margin-left: 0px;
  padding-left: 0px;
  margin-right: 4px;
}

/deep/.el-table td.el-table__cell div {
  vertical-align: middle;
}
/deep/.el-button+.el-dropdown{
  margin-left:0px;
}
/deep/.el-button+.el-button{
  margin-left:0px;
}
.el-button{
  padding-left: 6px !important;
  padding-right: 6px !important;
}
.blist {
  margin-bottom: 8px;
  width: 100%;
}

.blist .el-radio-group {
  margin-right: 8px;
}

.ddl {
  margin-bottom: 8px;
  width: 100%;

}

.ddl .el-dropdown {
  margin-right: 8px;
}

.listbar {
  margin-bottom: 8px;
  text-align: center;
}
 .el-dropdown-link {
  cursor: pointer;
  color: var(--el-color-primary);
  display: flex;
  align-items: center;
  font-size: 0.65rem;
}
/deep/.el-button--small{
  padding: 5px 4px;
}

.prepend /deep/.el-input__wrapper{
  border-top-right-radius:0;
  border-bottom-right-radius:0;
}
.prepend+/deep/.el-date-editor{
  border-top-left-radius:0;
  border-bottom-left-radius:0;
  border-left:0;
}

</style>